<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆-信息')" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-info-edit" th:object="${carInfo}">
            <input name="carInfoId" th:field="*{carInfoId}" type="hidden">
            <input name="carId" th:field="*{carId}" type="hidden">
            <input name="menuId" th:field="*{menuId}" type="hidden">
            <input name="configType" th:field="*{configType}" type="hidden">
            <input id="car_info" name="info" th:field="*{info}" type="hidden">
            <div class="form-group" th:if="${carInfo.carInfoId!=null}">
                <label class="col-sm-2 control-label">图片</label>
                <div class="col-sm-8"
                     th:include="system/common/file_upload :: multiple_img(_file_id='multipleFile',_file_type='img',_file_list=${@file.getFiles(carInfo.carId,carInfo.configType)})"/>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">日间行车灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.drl" th:field="*{infoMap.drl}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">示宽灯-前：</label>
                <div class="col-sm-2">
                    <input name="infoMap.clearanceLampFront" th:field="*{infoMap.clearanceLampFront}" class="form-control" type="number" />
                </div>
                <label class="col-sm-2 control-label">示宽灯-后：</label>
                <div class="col-sm-2">
                    <input name="infoMap.clearanceLampRear" th:field="*{infoMap.clearanceLampRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">近光灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.lowBeam" th:field="*{infoMap.lowBeam}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">远光灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.highBeam" th:field="*{infoMap.highBeam}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">前雾灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.fogLightsFront" th:field="*{infoMap.fogLightsFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">后雾灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.fogLightsRear" th:field="*{infoMap.fogLightsRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">转向灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.turnSignal" th:field="*{infoMap.turnSignal}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">前转向灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.turnSignalFront" th:field="*{infoMap.turnSignalFront}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">后转向灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.turnSignalRear" th:field="*{infoMap.turnSignalRear}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">侧边转向灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.turnSignalSide" th:field="*{infoMap.turnSignalSide}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">律动大灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.rhythmHeadlights" th:field="*{infoMap.rhythmHeadlights}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">高位刹车灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.brakeLightHigh" th:field="*{infoMap.brakeLightHigh}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">倒车灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.reversingLights" th:field="*{infoMap.reversingLights}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">牌照灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.licensePlateLight" th:field="*{infoMap.licensePlateLight}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">迎宾灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.welcomeLights" th:field="*{infoMap.welcomeLights}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">照地灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.floorLights" th:field="*{infoMap.floorLights}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">大灯高度调节：</label>
                <div class="col-sm-2">
                    <input name="infoMap.heightAdjustment" th:field="*{infoMap.heightAdjustment}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">自适应远近光灯：</label>
                <div class="col-sm-2">
                    <input name="infoMap.lowBeamLightsAuto" th:field="*{infoMap.lowBeamLightsAuto}" class="form-control" type="text" />
                </div>
                <label class="col-sm-2 control-label">大灯清洗：</label>
                <div class="col-sm-2">
                    <input name="infoMap.headlightCleaning" th:field="*{infoMap.headlightCleaning}" class="form-control" type="text" />
                </div>

                <label class="col-sm-2 control-label">大灯延时关闭）：</label>
                <div class="col-sm-2">
                    <input name="infoMap.headlightsTurnOff" th:field="*{infoMap.headlightsTurnOff}" class="form-control" type="text" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8"><button type="button" class="btn btn-success" onclick="submitHandler()">上传</button></div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/car/info";
        $("#form-info-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                let json=$('#form-info-edit').serializeJson();
                console.log(json)
                $('#car_info').val(JSON.stringify(json.infoMap)||'{}');
                let serialize = $('#form-info-edit').serialize();
                console.log(serialize)
                // console.log(JSON.stringify($('#form-info-edit').serializeJson()))
                // return;
                $.operate.save(prefix + "/edit?_="+Math.random(), serialize);
            }
        }
        $(function (){
            multipleFile_manager.init({busId: [[${carInfo.carId}]], busType: [[${carInfo.configType}]], fileType: 'img'});
        });
    </script>
</body>
</html>